package com.csii.excelapp.service.impl;

import com.csii.excelapp.mapper.ExcelMapper;
import com.csii.excelapp.service.IExcelService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

@Service
public class ExcelServiceImpl implements IExcelService {
    private static final Logger log = LoggerFactory.getLogger(ExcelServiceImpl.class);

    @Resource
    private ExcelMapper excelMapper;

    public ExcelServiceImpl() {
    }

    @Override
    public List<Map<String, Object>> getSqlResult(String paramSQL) {
        //防注入处理
        paramSQL = paramSQL.replaceAll("--", "")
                .replaceAll(";.+", "");
        return excelMapper.getSqlResult(paramSQL);
    }
}
